package com.atguigu.edu.publisher.mapper;

import com.atguigu.edu.publisher.beans.UserChangeCtPerType;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserStatsMapper {
    //回流+活跃+新增

    @Select("select 'backCt' type," +
            " sum(back_ct) back_ct " +
            " from dws_user_user_login_window " +
            " where toYYYYMMDD(stt) = #{date} " +
            " union all " +
            " select 'activeCt' type, " +
            " sum(uu_ct) uu_ct " +
            " from dws_user_user_login_window " +
            " where toYYYYMMDD(stt) = #{date} " +
            " union all " +
            " select 'newUserCt' type, " +
            "        sum(uu_ct) register_ct " +
            " from dws_user_active_login_window " +
            " where toYYYYMMDD(stt) = #{date};")
    List<UserChangeCtPerType> selectUserChangeCtPerType(@Param("date")Integer date);
}
